<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="css/login.css">
  <link rel="stylesheet" href="css/bootstrap.min.css">
  <script src="js/jquery.min.js"></script>
  <script src="js/popper.min.js"></script>
  <script src="js/bootstrap.min.js"></script>
  <script>
    $(document).ready(function () {
      $("#loginBtn").click(function () {
        //获取账号密码信息
        let account = $("#account").val();
        let pwd = $("#pwd").val();
        //创建对象
        let RbacManager={
          "account":account,
          "password":pwd
        }
        //发送请求提交数据
        $.ajax({
          url: "managercontroller/login",//路径
          type: "POST",//请求方式
          headers : {'Content-Type': 'application/json'},//设置请求头
          data : JSON.stringify(RbacManager),//JSON类型数据格式
          success : function(result){
            if (result=="成功"){
              alert("登录成功")
            }else {
              alert("账号或密码错误")
            }

          }
        });
      });
    // 注册按钮的点击事件
      $("#register").click(function() {
        window.location.href ="/register.html";
      })

    });
  </script>

</head>
<!-- <body style="  background: url(images/1.jpg) no-repeat;"></body> -->

<body>
<div class="login">
  <p>Login</p>
  <input type="text" id="account" placeholder="用户名" autocomplete="off"
         onKeypress="javascript:if(event.keyCode == 32)event.returnValue = false;">
  <input type="password" id="pwd" placeholder="密码" autocomplete="off"
         onKeypress="javascript:if(event.keyCode == 32)event.returnValue = false;">
  <p></p>
  <button id="loginBtn" class="btn btn-success">登录</button>
  <button id="register" class="btn btn-success">注册</button>
</div>

</body>

</html>